<?php

class Mapper
{
    static public function fromTwitter($data)
    {
        $result = array(
            'idp_id' => $data['id'],
            'name' => $data['name'],
            'username' => $data['screen_name'],
            'location' => $data['location'],
            'description' => $data['description'],
            'profile_url' => $data['url'],
            'birthday'=>$data['birthday'],
            'profile_image_url' => $data['profile_image_url'],
            'idp_service' => 'twitter',
        );
        return $result;
    }

    static public function fromLive($data)
    {
        $result = array(
            'idp_id' => $data['id'],
            'name' => $data['name'],
            'profile_url' => $data['link'],
            'gender' => $data['gender'],
            'birthday'=>$data['birthday'],
            'email' => $data['emails']['preferred'],
            'idp_service' => 'live',
        );
        return $result;
    }

    static function fromGoogle($data)
    {

        $result = array(
            'idp_id' => $data['id'],
            'email' => $data['email'],
            'name' => $data['name'],
            'birthday' => $data['birthday'],
            'profile_image_url' => $data['picture'],
            'profile_url' => $data['link'],
            'gender' => $data['gender'],
            'idp_service' => 'google',
        );
        return $result;
    }

    static function fromFacebook($data)
    {
        $result = array(
            'idp_id' => $data['id'],
            'email' => $data['email'],
            'name' => $data['name'],
            'username' => $data['username'],
            'birthday' => $data['birthday'],
            'profile_image_url' => $data['picture'],
            'profile_url' => $data['link'],
            'gender' => $data['gender'],
            'idp_service' => 'facebook',
        );
        return $result;
    }

}
